<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width:  300px;
            height: 1000px;
            border: 10px solid red;
            background-image: url(images/img.jpg);
            background-repeat: no-repeat;
            background-attachment: fixed;
        }


    </style>
</head>
<body>
    <!--
        background-attachment       背景是否滚动
                    scroll          背景图片跟随滚动条滚动，默认值
                    fixed           背景图片不会跟随滚动条而滚动
    -->
    <div></div>
</body>
</html>